package br.com.dp.dao.entidade;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the usuario database table.
 * 
 */
@Entity
@Table(name="usuario")
@NamedQuery(name="Usuario.findAll", query="SELECT u FROM Usuario u")
public class Usuario implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(unique=true, nullable=false)
	private int id;

	@Column(length=45)
	private String dataAlteracao;

	@Temporal(TemporalType.DATE)
	@Column(nullable=false)
	private Date dataCadastro;

	@Column(nullable=false, length=60)
	private String email;

	@Column(nullable=false, length=45)
	private String login;

	@Column(nullable=false, length=80)
	private String nome;

	@Column(nullable=false, length=64)
	private String senha;

	//bi-directional one-to-one association to Admin
	@OneToOne(mappedBy="usuario")
	private Admin admin;

	//bi-directional one-to-one association to Cliente
	@OneToOne(mappedBy="usuario")
	private Cliente cliente;

	//bi-directional many-to-many association to Perfil
	@ManyToMany(mappedBy="usuarios1")
	private List<Perfil> perfils1;

	//bi-directional one-to-one association to Proprietario
	@OneToOne(mappedBy="usuario")
	private Proprietario proprietario;

	//bi-directional many-to-many association to Perfil
	@ManyToMany
	@JoinTable(
		name="asc_usuario_perfil"
		, joinColumns={
			@JoinColumn(name="idUsuario", nullable=false)
			}
		, inverseJoinColumns={
			@JoinColumn(name="idPerfil", nullable=false)
			}
		)
	private List<Perfil> perfils2;

	public Usuario() {
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getDataAlteracao() {
		return this.dataAlteracao;
	}

	public void setDataAlteracao(String dataAlteracao) {
		this.dataAlteracao = dataAlteracao;
	}

	public Date getDataCadastro() {
		return this.dataCadastro;
	}

	public void setDataCadastro(Date dataCadastro) {
		this.dataCadastro = dataCadastro;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getLogin() {
		return this.login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getNome() {
		return this.nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getSenha() {
		return this.senha;
	}

	public void setSenha(String senha) {
		this.senha = senha;
	}

	public Admin getAdmin() {
		return this.admin;
	}

	public void setAdmin(Admin admin) {
		this.admin = admin;
	}

	public Cliente getCliente() {
		return this.cliente;
	}

	public void setCliente(Cliente cliente) {
		this.cliente = cliente;
	}

	public List<Perfil> getPerfils1() {
		return this.perfils1;
	}

	public void setPerfils1(List<Perfil> perfils1) {
		this.perfils1 = perfils1;
	}

	public Proprietario getProprietario() {
		return this.proprietario;
	}

	public void setProprietario(Proprietario proprietario) {
		this.proprietario = proprietario;
	}

	public List<Perfil> getPerfils2() {
		return this.perfils2;
	}

	public void setPerfils2(List<Perfil> perfils2) {
		this.perfils2 = perfils2;
	}

}